package com.example.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * ClassName: CollectionDemo
 * Package: com.example.source
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-07-18
 * Time: 13:33
 */

//从集合中读取数据
public class CollectionDemo {
    public static void main(String[] args) throws Exception {

        //流执行环境
        StreamExecutionEnvironment env =
                StreamExecutionEnvironment.getExecutionEnvironment();

        //读取数据
        final DataStreamSource<Integer> source =
                //env.fromCollection(Arrays.asList(1, 23, 34));
                env.fromElements(1,2,33); //直接填写元素

        source.print(); //默认平行度 和电脑配置一样

        env.execute();

    }
}
